<template>
	<view class="box">
		<navSearchComponent @send="resvice" />
		<classifyComponent @sendClassify="sendClassify" @init="init"/>
		<view class="mainBox">
			<swiper class="swiper" :current="current" circular disable-touch="true" :duration="duration" @change="swiperChange">
				<swiper-item v-for="item in arrLenght" :key="item">
					<view class="swiper-item">
						<waterfall :serial="item"  :current="current" :pageSize="pageSize" :pageNum="pageNum" :columsp="columsp"></waterfall>
					</view>
				</swiper-item>
			</swiper>
			
		</view>
	</view>
</template>

<script>
	export default {
		name: "novelArea",
		data() {
			return {
				pageSize: 20,
				pageNum: 1,
				columsp: 2, //分割几列
				indicator: true,
				duration: 500,
				current: 0,
				list: [{
					thumb: "../../static/appIcon.png"
				}, {
					thumb: "../../static/appIcon.png"
				}, {
					thumb: "../../static/appIcon.png"
				}, {
					thumb: "../../static/appIcon.png"
				}, {
					thumb: "../../static/appIcon.png"
				}],
				arrLenght:0
			};
		},
		methods: {
			init(val){
				this.arrLenght=val
			},
			swiperChange(e) {
				this.current = e.detail.current
				// this.arr.map(item => item.flag = false)
				// let obj = this.arr[e.detail.current]
				// obj.flag = true
				// this.$set(this.arr, e.detail.current, obj)
				// this.left = obj.left
			},
			resvice(val) {
				console.log(val)
			},
			sendClassify(val) {
				this.current = val.id-1
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		height: 100vh;
		// padding-top: var(--status-bar-height);
		box-sizing: border-box;
		display: flex;
		flex-direction: column;

		.mainBox {
			height: calc(100% - 200rpx);
			padding: 30rpx;
			box-sizing: border-box;
			background-color: #e7ecfa;

			.swiper {
				height: 100%;

				.swiper-item {
					height: 100%;
				}
			}
		}
	}
</style>